package cn.wsalix.msg.entity;

import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.FetchType;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import cn.anlaser.entity.SimpleEntity;
import cn.wsalix.shop.status.MessEnum;
import cn.wsalix.type.MessTypeEnum;
import cn.wsalix.type.PushTypeEnum;

@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "MESSAGE")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@EntityListeners({ AuditingEntityListener.class })
@Data
@EqualsAndHashCode(exclude={},callSuper = false)
@ToString(exclude = { })
public class Message extends SimpleEntity {
	/**
		 * 
		 */
	private static final long serialVersionUID = 8500867520550921062L;
	private String title;
/*	private String msgId;
	private String msgTime;*/
	private MessEnum status;
	private boolean push=false;//推送设置
	private PushTypeEnum pushType;
	@Temporal(TemporalType.TIMESTAMP)
	private Date planSendTime;
	@Lob
	@Basic(fetch = FetchType.LAZY)
	@Column(name = "content", columnDefinition = "TEXT", nullable = true, length = 100000)
	private String content;
	private MessTypeEnum type;
	private Long fkId;
	private String ramark;
/*	
	@JsonIgnore
	@ManyToOne(cascade = CascadeType.MERGE, optional = true, fetch = FetchType.LAZY)
	@JoinColumn(name = "ORDER_ID")
	private Order order;//通过订单给用户发消息
	
	@JsonIgnore
	@ManyToOne(cascade = CascadeType.MERGE, optional = true, fetch = FetchType.LAZY)
	@JoinColumn(name = "MASTERTUAN_ID")
	private MasterTuan masterTuan;//给所有团购用户发消息
	
	@JsonIgnore
	@ManyToOne(cascade = CascadeType.MERGE, optional = true, fetch = FetchType.LAZY)
    @JoinColumn(name="PRODUCT_ID")
	private Product product;//生成产品消息
*/
}